package com.chat.datea.fragment;

import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chat.datea.R;
import com.chat.datea.adapter.MusicClubFragment_ViewPager_Adapter;
import com.chat.datea.base.BaseFragment;

/**
 * Created by xyb on 15/10/20.
 */
public class MusicClubFragment extends BaseFragment {
    private MusicClubFragment_ViewPager_Adapter pagerAdapter;
    private ViewPager viewPager;
    private TabLayout tabLayout;
    private FragmentManager fManager;

    public MusicClubFragment(FragmentManager fManager) {
        this.fManager = fManager;
    }

    @Override
    protected void initData() {
        viewPager.setAdapter(pagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setSelectedTabIndicatorColor(0xff0088ff);
    }

    @Override
    protected void initView() {
        pagerAdapter = new MusicClubFragment_ViewPager_Adapter(fManager,getChildFragmentManager());
        viewPager = (ViewPager) view.findViewById(R.id.musicViewPager);
        tabLayout = (TabLayout) view.findViewById(R.id.TabLayout);
    }

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container) {
        view = inflater.inflate(R.layout.fragment_musicclub, null);
        return view;
    }

}
